#ifndef DOUBLY_LINKED_LIST_H
#define DOUBLY_LINKED_LIST_H


#define MAX_TITLE_LENGTH        128
#define MAX_TIMESTAMP_LENGTH    30
#define MAX_URL_LENGTH          128

typedef struct {
    char title[MAX_TITLE_LENGTH];
    char timestamp[MAX_TIMESTAMP_LENGTH];
    char url[MAX_URL_LENGTH];
} BrowserData_t;

typedef struct ListNode{
    BrowserData_t browserData;
    struct ListNode *prev;
    struct ListNode *next;
} DoublyNode_t;

typedef enum {
    LINKED_LIST_SUCCESS,
    LINKED_LIST_FAIL,
}DoublyStatus_t;

DoublyNode_t* DoublyLinkedInit();
DoublyStatus_t DoublyLinkedInsertToHead(DoublyNode_t *head, BrowserData_t *data);
DoublyStatus_t DoublyLinkedInsertToTail(DoublyNode_t *head, BrowserData_t *data);
DoublyStatus_t DoublyLinkedInsertCom(DoublyNode_t *head, int index, BrowserData_t *data);
DoublyNode_t *DoublyLinkedSearchByIndex(DoublyNode_t *head, int index);
DoublyNode_t *DoublyLinkedSearchByData(DoublyNode_t *head, BrowserData_t *data);
DoublyStatus_t DoublyLinkedDeleteByIndex(DoublyNode_t *head, int index);
DoublyStatus_t DoublyLinkedDeleteByData(DoublyNode_t *head, BrowserData_t *data);
void DoublyLinkedDestroy(DoublyNode_t *head);

#endif
